﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>单文件上传示例</title>
    <link href="js/up2.css" type="text/css" rel="Stylesheet"/>
    <script src="js/jquery-1.3.2.min.js" type="text/javascript"></script>
    <script src="js/json2.min.js" type="text/javascript" charset="utf-8"></script>
    <script src="js/up2.app.js" type="text/javascript" charset="utf-8"></script>
    <script src="js/up2.edge.js" type="text/javascript" charset="utf-8"></script>
    <script src="js/up2-single.js" type="text/javascript" charset="utf-8"></script>
    <script language="javascript" type="text/javascript">
        //根路径：http://localhost/api/up2/
        var pos = window.location.href.lastIndexOf("/");
        var api = [
            window.location.href.substr(0, pos + 1),
            "upload.jsp"
        ].join("");
        var up2 = new HttpUploaderMgr({
            config: {
                PostUrl: api,
                FileFieldName: "file"//文件字段名称
            },
            event: {
                selFile: function () {
                    $("#btnSel").attr("disabled", true);
                },
                postComplete: function () {
                    $("#btnSel").attr("disabled", false);
                },
                postError: function () { },
                postProcess: function (obj, speed, postedLength, percent, times) { }
            },
            ui: { render: "upPnl" }
        });

        $(function ()
        {

            //上传用户选择的文件
            $("#btnSel").click(function ()
            {
                up2.openFile();
            });
        });
    </script>
</head>
<body>
    <p>此页面演示单个文件上传样式</p>
    <div id="upPnl"></div>
    <input id="btnSel" type="button" value="选择文件" />
</body>
</html>